package com.sxpi.chapter.chapter04.c02;

import com.sxpi.chapter.chapter04.c01.DrawController;
import com.sxpi.chapter.chapter04.c01.User;
import java.util.ArrayList;
import java.util.List;

/**
 * @author 飞哥
 * @Title: 学相伴出品
 * @Description: 飞哥B站地址：https://space.bilibili.com/490711252
 * 记得关注和三连哦！
 * @Description: 我们有一个学习网站：https://www.kuangstudy.com
 * @date 2022-09-01$ 2:22$
 */
public class DrawControllerTest {

    public static void main(String[] args) {
        List<User> list = new ArrayList<>();
        list.add(new User("小章",11));
        list.add(new User("小白",351));
        list.add(new User("小红",13));
        list.add(new User("小花",12));
        list.add(new User("小乖",132));
        // 随机
        IDraw drawRandom = new DrawRandom();
        List<User> list1 = drawRandom.drawUser(list, 3);
        System.out.println("随机的方式:");
        list1.forEach(System.out::println);
        // 权重方式
        IDraw drawWeight = new DrawWeight();
        List<User> list2 = drawWeight.drawUser(list, 3);
        System.out.println("权重的方式:");
        list2.forEach(System.out::println);
    }
}

